supernova: fixes for boost-1.49 and gcc-4.7
[supercollider.git] / Help / UGens / Synth control / Demand Rate / Dwrand.html
blobd12acd7660fbb4a274a40c02da6a6e10e3f8c2f8
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="1038.32">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #1738f5}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #cd1713}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000; min-height: 12.0px}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #000000}
16 span.s1 {font: 18.0px Helvetica}
17 span.s2 {color: #000000}
18 span.s3 {color: #0000ff}
19 span.s4 {font: 12.0px Helvetica; color: #000000}
20 span.s5 {color: #102ac3}
21 span.Apple-tab-span {white-space:pre}
22 </style>
23 </head>
24 <body>
25 <p class="p1"><span class="s1"><b>Dwrand<span class="Apple-tab-span"> </span></b></span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>demand rate weighted random sequence generator</b></p>
26 <p class="p2"><br></p>
27 <p class="p1">superclass: DUGen</p>
28 <p class="p2"><br></p>
29 <p class="p2"><br></p>
30 <p class="p1"><span class="Apple-tab-span"> </span><b>*new(array, weights, length)</b></p>
31 <p class="p2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
32 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>array</b><span class="Apple-tab-span"> </span>array of values or other ugens</p>
33 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>weights</b><span class="Apple-tab-span"> </span>array of values (should sum up to 1.0)</p>
34 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><b>length</b><span class="Apple-tab-span"> </span>number of values to return</p>
35 <p class="p2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
36 <p class="p3"><span class="s2"><span class="Apple-tab-span"> </span>structurally related: <a href="../../../Streams-Patterns-Events/Patterns/Pwrand.html"><b>Pwrand</b></a></span><b>, </b><a href="../../Triggers/TWindex.html"><b>TWindex</b></a><b>, </b><a href="../../Triggers/TWChoose.html"><b>TWChoose</b></a></p>
37 <p class="p1"><b><i><span class="Apple-tab-span"> </span></i></b>see also: <a href="Demand.html"><span class="s3"><b>Demand</b></span></a></p>
38 <p class="p2"><span class="Apple-tab-span"> </span></p>
39 <p class="p2"><span class="Apple-tab-span"> </span></p>
40 <p class="p4"><span class="s4"><span class="Apple-tab-span"> </span></span>// example</p>
41 <p class="p5"><span class="Apple-tab-span"> </span></p>
42 <p class="p6"><span class="Apple-tab-span"> </span>(</p>
43 <p class="p6"><span class="Apple-tab-span"> </span>{<span class="Apple-converted-space"> </span></p>
44 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s5">var</span> a, freq, trig;</p>
45 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a = <span class="s5">Dwrand</span>([0, 1, 2, 7], [0.4, 0.4, 0.1, 0.1], <span class="s5">inf</span>).dpoll;</p>
46 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>trig = <span class="s5">Impulse</span>.kr(<span class="s5">MouseX</span>.kr(1, 400, 1));</p>
47 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>freq = <span class="s5">Demand</span>.kr(trig, 0, a) * 30 + 340;<span class="Apple-converted-space"> </span></p>
48 <p class="p6"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s5">SinOsc</span>.ar(freq) * 0.1</p>
49 <p class="p5"><span class="Apple-tab-span"> </span></p>
50 <p class="p6"><span class="Apple-tab-span"> </span>}.play;</p>
51 <p class="p6"><span class="Apple-tab-span"> </span>)</p>
52 <p class="p5"><span class="Apple-tab-span"> </span></p>
53 <p class="p5"><span class="Apple-tab-span"> </span></p>
54 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
55 <p class="p5"><span class="Apple-tab-span"> </span></p>
56 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
57 <p class="p5"><span class="Apple-tab-span"> </span></p>
58 <p class="p5"><span class="Apple-tab-span"> </span></p>
59 </body>
60 </html>